import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/article/list',
    method: 'get',
    params: query
  })
}

export function fetchArticle() {
  return request({
    url: '/article/detail',
    method: 'get'
  })
}

export function fetchPv(pv) {
  return request({
    url: '/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function createArticle(data) {
  return request({
    url: '/article/create',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/article/update',
    method: 'post',
    data
  })
}

import { baseUrl, doRequestPost, doRequestDel, doRequestPut, doRequestGet } from '../utils/request'

export function userArticleList(query) {
  return doRequestPost(baseUrl + 'news/info/user/pageList' + '?time=' + (+new Date()), query)
}

export function listNewsInfo(query) {
  return doRequestPost(baseUrl + 'open/listNewsInfo' + '?time=' + (+new Date()), query)
}
export function listTopicInfo(query) {
  return doRequestPost(baseUrl + 'open/listSeminarInfo' + '?time=' + (+new Date()), query)
}

export function articleList(query) {
  return doRequestPost(baseUrl + 'news/info/pageList' + '?time=' + (+new Date()), query)
}

export function articleAuditList(query) {
  return doRequestPost(baseUrl + 'news/info/pageAuditList' + '?time=' + (+new Date()), query)
}

export function articleAnalysis(query) {
  return doRequestPost(baseUrl + 'news/info/analysis' + '?time=' + (+new Date()), query)
}

export function articleAdd(query) {
  return doRequestPost(baseUrl + 'news/info/add' + '?time=' + (+new Date()), query)
}

export function articleDelete(query) {
  // return doRequestDel(baseUrl + 'news/info/delete/' + query.id + '?time=' + (+new Date()), {})
  return doRequestPost(baseUrl + 'news/info/batchFailure' + '?time=' + (+new Date()), [query.id])
}

export function articlePut(query) {
  return doRequestPost(baseUrl + 'news/info/update' + '?time=' + (+new Date()), query)
}

export function updateAppScene(query) {
  return doRequestPost(baseUrl + 'news/info/updateAppStatus' + '?time=' + (+new Date()), query)
}

export function articleGet(query) {
  return doRequestGet(baseUrl + 'news/info/getEdit/' + query.id + '?time=' + (+new Date()), {})
}

export function ZtArticleGet(query) {
  return doRequestGet(baseUrl + 'news/info/getEdit/' + query.news_id + '?time=' + (+new Date()), {})
}

export function articleGetSc(query) {
  return doRequestGet(baseUrl + 'news/info/getEditSc/' + query.id + '?time=' + (+new Date()), {})
}

export function articleSourceGet(query) {
  return doRequestGet(baseUrl + 'news/source/get/' + query.id + '?time=' + (+new Date()), {})
}

export function getRwList() {
  return doRequestGet(baseUrl + 'open/vocabulary/list/rw' + '?time=' + (+new Date()), {})
}

export function getJgList() {
  return doRequestGet(baseUrl + 'open/vocabulary/list/jg' + '?time=' + (+new Date()), {})
}

export function getListArea() {
  return doRequestGet(baseUrl + 'plate/area/listArea' + '?time=' + (+new Date()), {})
}

export function getChartList() {
  return doRequestGet(baseUrl + 'flowChart/selectInfo' + '?time=' + (+new Date()), {})
}

export function articlePlateList(query) {
  return doRequestPost(baseUrl + 'cms/plateinfo/listTree' + '?time=' + (+new Date()), query)
}

export function articleStockList(query) {
  return doRequestPost(baseUrl + 'cms/stock/listSimple' + '?time=' + (+new Date()), query)
}

export function articleAllPlateList(query) {
  return doRequestPost(baseUrl + 'cms/plateinfo/listAllSimpleChild' + '?time=' + (+new Date()), query)
}

export function classList(query) {
  return doRequestPost(baseUrl + 'cms/newsclass/list' + '?time=' + (+new Date()), query)
}

export function userClassList(query) {
  return doRequestPost(baseUrl + 'cms/newsclass/user/list' + '?time=' + (+new Date()), query)
}

export function batchAudited(query) {
  return doRequestPost(baseUrl + 'news/info/batchAudited' + '?time=' + (+new Date()), query)
}

export function auditReject(query) {
  return doRequestPost(baseUrl + 'news/info/auditReject' + '?time=' + (+new Date()), query)
}

export function batchOnline(query) {
  return doRequestPost(baseUrl + 'news/info/batchOnline' + '?time=' + (+new Date()), query)
}

export function batchRevocation(query) {
  return doRequestPost(baseUrl + 'news/info/batchRevocation' + '?time=' + (+new Date()), query)
}

export function batchDelete(query) {
  // return doRequestPost(baseUrl + 'news/info/batchDelete' + '?time=' + (+new Date()), query)
  return doRequestPost(baseUrl + 'news/info/batchFailure' + '?time=' + (+new Date()), query)
}

export function analysisImage(query) {
  return doRequestPost(baseUrl + 'cms/strategy/execute' + '?time=' + (+new Date()), query)
}

export function analysisImageList(query) {
  return doRequestPost(baseUrl + 'cms/strategy/list' + '?time=' + (+new Date()), query)
}

export function newsCount(query) {
  return doRequestPost(baseUrl + 'news/info/count' + '?time=' + (+new Date()), query)
}

export function listStockSc() {
  return doRequestGet(baseUrl + 'cms/stock/listStockSc' + '?time=' + (+new Date()), {})
}

export function uploadSec(query) {
  return doRequestPost(baseUrl + 'file/oss/content/uploadSec' + '?time=' + (+new Date()), query)
}



// export function kxInfo(code) {
//   return doRequestGet(baseUrl + 'hq/kx.do?code='+ code +'&return=2&count=30&type=513', {})
// }

// export function fsInfo(query) {
// 	let str = ''
// 	if(query.time){
// 		str = 'hq/fs.do?code='+ query.code + '&time=' + query.time + '&'
// 	} else {
// 		str = 'hq/fs.do?code='+ query.code
// 	}
//   return doRequestGet(baseUrl + str, {})
// }

// export function kxInfo(code) {
//   return doRequestGet(baseUrl + 'open/kx?code='+ code +'&return=2&count=30&type=513', {})
// }

export function kxInfo(query) {
  return doRequestPost(baseUrl + 'open/kxma' + '?time=' + (+new Date()), query)
}

export function fsInfo(query) {
  return doRequestGet(baseUrl + 'open/fs?code='+ query.code + '&date=' + query.date, {})
}

export const originalUploadUrl = baseUrl + 'file/oss/single/upload'
//综合查询
//添加查询条件
export function addCondition(query) {
  return doRequestPost(baseUrl + '/news/condition/add' + '?time=' + (+new Date()), query)
}
//修改查询条件
export function updateCondition(query) {
  return doRequestPost(baseUrl + '/news/condition/update' + '?time=' + (+new Date()), query)
}
//删除查询条件
export function deleteCondition(query) {
  return doRequestPost(baseUrl + '/news/condition/delete' + '?time=' + (+new Date()), query)
}
//查询条件详情
export function getCondition(id,query) {
  return doRequestGet(baseUrl + '/news/condition/get/'+id + '?time=' + (+new Date()), query)
}
//查询条件列表
export function searchConditionList(query) {
  return doRequestPost(baseUrl + 'news/condition/searchConditionList' + '?time=' + (+new Date()), query)
}
//查询内容列表
export function newsListByCondition(query) {
  return doRequestPost(baseUrl + '/news/condition/newsListByCondition' + '?time=' + (+new Date()), query)
}
//第三方栏目查询
export function thirdPartClassList(type,query) {
  return doRequestGet(baseUrl + '/news/condition/thirdPartClassList/'+type+'?time='+(+new Date()),query)
}

export function tagsSearch(query) {
  return doRequestPost(baseUrl + '/cms/tags/search' + '?time=' + (+new Date()), query)
}
export function tagsdetail(query) {
  return doRequestPost(baseUrl + 'cms/tags/detail/tagNewsGraph' + '?time=' + (+new Date()), query)
}

export function  updateOrderTime(query) {
  return doRequestPost(baseUrl + 'news/info/updateOrderTime' + '?time=' + (+new Date()), query)
}
